/**
 * 
 */
package org.codesketch.flamingo.utils;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

/**
 * @author quirino.brizi
 *
 */
public class JSONUtils {
	/**
	 * Serialise the given object to JSON using jackson.
	 * @param obj the object to have to serialise.
	 * @return the JSON representation of the object
	 * @throws JsonGenerationException
	 * @throws JsonMappingException
	 * @throws IOException
	 */
	public static final String toJSON(Object obj) throws JsonGenerationException, JsonMappingException, IOException {
		ObjectMapper mapper = new ObjectMapper();
		return mapper.writeValueAsString(obj);
	}
}
